OstreeMutableTree: Document each private member of `OstreeMutableTree`
authorWilliam Manley <will@williammanley.net>
Fri, 22 Jun 2018 10:37:37 +0000 (11:37 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 25 Jun 2018 16:22:21 +0000 (16:22 +0000)
A prelude to my understanding.  Unfortunately `OstreeMutableTree` provides
little encapsulation, as each member has setters† so it's difficult to come
up with a list of invariants.

† `files` and `subdirs` only have getters, but the getters return mutable
  references to the internals, so we still can't reason about invariants.

Closes: #1645
Approved by: jlebon

src/libostree/ostree-mutable-tree.c

index 5cff5d82bd59bcb9e3ac834f0e1168028ddcf47d..f46e36dbe42288c0671350dffdb9b786dce90e9d 100644 (file)
@@ -47,10 +47,20 @@ struct OstreeMutableTree
 {
   GObject parent_instance;
 
+  /* This is the checksum of the Dirtree object that corresponds to the current
+   * contents of this directory.  contents_checksum can be NULL if the SHA was
+   * never calculated or contents of the mtree has been modified.  Even if
+   * contents_checksum is not NULL it may be out of date. */
   char *contents_checksum;
+
+  /* This is the checksum of the DirMeta object that holds the uid, gid, mode
+   * and xattrs of this directory.  This can be NULL. */
   char *metadata_checksum;
 
+  /* const char* filename -> const char* checksum */
   GHashTable *files;
+
+  /* const char* filename -> OstreeMutableTree* subtree */
   GHashTable *subdirs;
 };